home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
netlib
/
RCS
/
Net_AddrToString.c,v
< prev
next >
Wrap
Text File
|
1992-06-09
|
6KB
|
300 lines
head 1.6;
branch ;
access ;
symbols sprited:1.2.1;
locks ; strict;
comment @ * @;
1.6
date 92.06.09.20.54.01; author jhh; state Exp;
branches ;
next 1.5;
1.5
date 92.03.27.14.38.58; author voelker; state Exp;
branches ;
next 1.4;
1.4
date 92.03.27.14.28.32; author jhh; state Exp;
branches ;
next 1.3;
1.3
date 92.03.02.17.45.35; author voelker; state Exp;
branches ;
next 1.2;
1.2
date 90.09.11.14.43.47; author kupfer; state Exp;
branches 1.2.1.1;
next 1.1;
1.1
date 90.09.05.16.49.29; author kupfer; state Exp;
branches ;
next ;
1.2.1.1
date 91.10.22.14.18.04; author kupfer; state Exp;
branches ;
next ;
desc
@Convert a Net_Address into a printable string.
@
1.6
log
@got rid of backwards compatibility
@
text
@/*
* Net_AddrToString.c --
*
* Converts a Net_Address into a printable string.
*
* Copyright 1990 Regents of the University of California
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*/
#ifndef lint
static char rcsid[] = "$Header: /sprite/src/lib/net/RCS/Net_AddrToString.c,v 1.5 92/03/27 14:38:58 voelker Exp $ SPRITE (Berkeley)";
#endif /* not lint */
#include <sprite.h>
#include <stdio.h>
#include <net.h>
/*
*----------------------------------------------------------------------
*
* Net_AddrToString --
*
* Converts a Net_Address into a printable string.
*
* Results:
* Pointer to the string.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
char *
Net_AddrToString(netAddressPtr, buffer)
Net_Address *netAddressPtr; /* Network address. */
char *buffer; /* The string buffer. */
{
ReturnStatus status = SUCCESS;
*buffer = '\0';
switch(netAddressPtr->type) {
case NET_ADDRESS_ETHER: {
Net_EtherAddress etherAddress;
status = Net_GetAddress(netAddressPtr, (Address) ðerAddress);
if (status != SUCCESS) {
break;
}
buffer = Net_EtherAddrToString(ðerAddress, buffer);
break;
}
case NET_ADDRESS_ULTRA: {
Net_UltraAddress ultraAddress;
status = Net_GetAddress(netAddressPtr, (Address) &ultraAddress);
if (status != SUCCESS) {
break;
}
buffer = Net_UltraAddrToString(&ultraAddress, buffer);
break;
}
case NET_ADDRESS_FDDI: {
Net_FDDIAddress fddiAddress;
status = Net_GetAddress(netAddressPtr, (Address) &fddiAddress);
if (status != SUCCESS) {
break;
}
buffer = Net_FDDIAddrToString(&fddiAddress, buffer);
break;
}
case NET_ADDRESS_INET: {
Net_InetAddress inetAddress;
status = Net_GetAddress(netAddressPtr, (Address) &inetAddress);
if (status != SUCCESS) {
break;
}
buffer = Net_InetAddrToString(inetAddress, buffer);
break;
}
}
if (status != SUCCESS) {
#ifdef KERNEL
return (char*) NIL;
#else
return NULL;
#endif
}
return buffer;
}
@
1.5
log
@changed the FDDI address to use Net_FDDIAddrToString() instead of
Net_EtherAddrToString()
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: /sprite/src/lib/net/RCS/Net_AddrToString.c,v 1.4 92/03/27 14:28:32 jhh Exp Locker: voelker $ SPRITE (Berkeley)";
a23 3
#ifdef NEW_NET
#undef Net_AddrToString
d28 1
a28 1
* Net_AddrToStringNew --
d42 1
a42 1
Net_AddrToStringNew(netAddressPtr, buffer)
a95 59
#else /* NEW_NET */
#define Net_AddressOld Net_Address
#endif /* NEW_NET */
/*
*----------------------------------------------------------------------
*
* Net_AddrToString --
*
* Converts a Net_Address into a printable string.
*
* Results:
* Pointer to the string.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
char *
Net_AddrToString(netAddressPtr, protocol, netType, buffer)
Net_AddressOld *netAddressPtr; /* Network address. */
int protocol; /* Network protocol (eg raw, inet). */
Net_NetworkType netType; /* Type of network (eg ether). */
char *buffer; /* The string buffer. */
{
*buffer = '\0';
switch(protocol) {
case NET_PROTO_RAW: {
switch(netType) {
case NET_NETWORK_ETHER:
return Net_EtherAddrToString(&netAddressPtr->ether, buffer);
break;
case NET_NETWORK_ULTRA: {
int group;
int unit;
Net_UltraAddressGet(&netAddressPtr->ultra, &group, &unit);
sprintf(buffer, "%d/%d", group, unit);
break;
}
case NET_NETWORK_FDDI:
return Net_FDDIAddrToString(&netAddressPtr->fddi, buffer);
break;
default:
return buffer;
}
break;
}
case NET_PROTO_INET: {
return Net_InetAddrToString(netAddressPtr->inet, buffer);
break;
}
default:
return buffer;
break;
}
return buffer;
}
@
1.4
log
@added Net_AddrToStringNew() to work with the new net module
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: /sprite/src/lib/net/RCS/Net_AddrToString.c,v 1.3 92/03/02 17:45:35 voelker Exp Locker: jhh $ SPRITE (Berkeley)";
d141 1
a141 1
return Net_EtherAddrToString(&netAddressPtr->fddi, buffer);
@
1.3
log
@added fddi (checked in by jhh)
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: /sprite/src/lib/net/RCS/Net_AddrToString.c,v 1.2 90/09/11 14:43:47 kupfer Exp Locker: voelker $ SPRITE (Berkeley)";
d23 4
d31 75
d121 1
a121 1
Net_Address *netAddressPtr; /* Network address. */
a157 1
@
1.2
log
@Lint.
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: /sprite/src/lib/net/RCS/Net_AddrToString.c,v 1.1 90/09/05 16:49:29 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)";
d61 3
@
1.2.1.1
log
@Initial branch for Sprite server.
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: /sprite/src/lib/net/RCS/Net_AddrToString.c,v 1.2 90/09/11 14:43:47 kupfer Exp $ SPRITE (Berkeley)";
@
1.1
log
@Checked in for John H. (?)
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: /sprite/lib/forms/RCS/proto.c,v 1.3 90/01/12 12:03:36 douglis Exp $ SPRITE (Berkeley)";
d21 1
@